package fr.vvins.core.search.query;

import java.util.ArrayList;
import java.util.List;

/**
 * Suggest query is a container for autosuggest and completion function.
 * @author fguay
 */
public class SuggestQuery {
    
    private static final String DEFAULT_FIELD = "text";

    private static final int DEFAULT_LIMIT = 5;

    private List<String> fields;
    
    private String term; 
    
    private int limit;
    
    public SuggestQuery(){
        setLimit(10);
        fields = new ArrayList<String>();
        fields.add(DEFAULT_FIELD);
    }
    
    public SuggestQuery(String pTerm){
        setTerm(pTerm);
        setLimit(DEFAULT_LIMIT);
        fields = new ArrayList<String>();
        fields.add(DEFAULT_FIELD);
    }
    
    public SuggestQuery(String pTerm, int pLimit){
        setTerm(pTerm);
        setLimit(pLimit);
        fields = new ArrayList<String>();
        fields.add("title");
        fields.add("name");
        fields.add("surname");
    }
    
    public SuggestQuery(String pTerm, int pLimit, List<String> pFields){
        setTerm(pTerm);
        setLimit(pLimit);
        setFields(pFields);
    }

    public List<String> getFields() {
        return fields;
    }

    public void setFields(List<String> pFields) {
        fields = pFields;
    }

    public String getTerm() {
        return term;
    }

    public void setTerm(String pTerm) {
        term = pTerm;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int pLimit) {
        limit = pLimit;
    }
}
